import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:zenge_web_flutter/custom/appBar_widget.dart';
import 'package:zenge_web_flutter/custom/custom_widget.dart';
import 'package:zenge_web_flutter/date_base/my_home_date.dart';
import 'package:zenge_web_flutter/view/keep_alive.dart';

import 'state.dart';

Widget buildView(
    CooperationState state, Dispatch dispatch, ViewService viewService) {
  double screenWidth = 1920;
  double screenHeight =
      (650 / 1920) * 1920;
  return Scaffold(
    body: Container(
      width: MediaQuery.of(viewService.context).size.width,
      alignment: Alignment.center,
      child: Container(
        width: screenWidth,
        alignment: Alignment.center,
        child: ListView(
          shrinkWrap: true,
          controller: state.scrollController,
          children: [
            Stack(
              children: [
                Positioned(
                  top: 65,
                  child: Container(
                    width: screenWidth,
                    height: 380/1920*screenWidth,
                    child: new Image.network(
                      'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2225535.jpg',
                      fit: BoxFit.fill,
                    ),
                  ),
                ),
                AppBarWidget(boxHeight: 380,),
              ],
            ),

            Container(
              width: screenWidth,
              height: 560,
              color: Colors.white,
              child: Stack(
                children: [
                  Positioned(
                    top:160,
                    left: 450,
                    child: Container(
                      width: 130,
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          new Image.network(
                            'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2222015.jpg',
                            fit: BoxFit.fill,
                          ),
                          SizedBox(height: 10,),
                          SelectableText('更大市场',style: TextStyle(fontSize: 20,color: Colors.black),)
                        ],
                      ),
                    ),
                  ),
                  Positioned(
                    top:160,
                    left: 450+130+(screenWidth-390-450*2)/2,
                    child: Container(
                      width: 130,
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          new Image.network(
                            'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2222016.jpg',
                            fit: BoxFit.fill,
                          ),
                          SizedBox(height: 10,),
                          SelectableText('更多业务',style: TextStyle(fontSize: 20,color: Colors.black),)
                        ],
                      ),
                    ),
                  ),
                  Positioned(
                    top:160,
                    left: 450+(130+(screenWidth-390-450*2)/2)*2,
                    child: Container(
                      width: 130,
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          new Image.network(
                            'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2222017.jpg',
                            fit: BoxFit.fill,
                          ),
                          SizedBox(height: 10,),
                          SelectableText('更深信任',style: TextStyle(fontSize: 20,color: Colors.black),)
                        ],
                      ),
                    ),
                  ),
                  // Column(
                  //   mainAxisAlignment: MainAxisAlignment.center,
                  //   crossAxisAlignment: CrossAxisAlignment.center,
                  //   children: [
                  //     new Image.network(
                  //       'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2222016.jpg',
                  //       fit: BoxFit.fill,
                  //     ),
                  //     SizedBox(height: 10,),
                  //     SelectableText('更多业务',style: TextStyle(fontSize: 20,color: Colors.black),)
                  //   ],
                  // ),
                  // Column(
                  //   mainAxisAlignment: MainAxisAlignment.center,
                  //   crossAxisAlignment: CrossAxisAlignment.center,
                  //   children: [
                  //     new Image.network(
                  //       'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2222017.jpg',
                  //       fit: BoxFit.fill,
                  //     ),
                  //     SizedBox(height: 10,),
                  //     SelectableText('更深信任',style: TextStyle(fontSize: 20,color: Colors.black),)
                  //   ],
                  // ),
                ],
              ),
            ),
            Container(
              width: screenWidth,
              height: 255/1920*screenWidth,
              child: Stack(
                children: [
                  ImageWidget(
                    width: screenWidth,
                    height: 900,
                    imageUrl:
                    'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2172111.jpg',
                  ),
                  Container(
                    width: screenWidth,
                    height: 255/1920*screenWidth,
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        SelectableText('我们的合作模式',style: TextStyle(fontSize: 40,color: Colors.white),),
                        SizedBox(height: 10,),
                        Container(height: 4,color: Colors.white,width: 80,),
                        SizedBox(height: 20,),
                        SelectableText('为客户提供完善的产品开发、包装设计、APP开发等智能家居解决方案，更好地为客户开拓智能产品全球市场',textAlign: TextAlign.center,style: TextStyle(color: Colors.white,fontSize: 12,),),
                      ],
                    ),
                  ),
                ],
              ),
            ),
            ImageWidget(
              width: screenWidth,
              height: 1085/1920*screenWidth,
              imageUrl:
              'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2238024.jpg',
            ),
            ImageWidget(
              width: screenWidth,
              height: 1000/1920*screenWidth,
              imageUrl:
              'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2172656.jpg',
            ),

            ImageWidget(
              width: screenWidth,
              height: 920/1920*screenWidth,
              imageUrl:
              'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2173781.jpg',
            ),
            ImageWidget(
              width: screenWidth,
              height: 975/1920*screenWidth,
              imageUrl:
              'http://nwzimg.wezhan.hk/contents/sitefiles3603/18018508/images/2173780.jpg',
            ),
            KeepAliveWidget(viewService.buildComponent("bottom_info")),
          ],
        ),
      ),
    ),
      floatingActionButton: FloatingActionButton(
        backgroundColor: Colors.white,
        onPressed: () {
          // scrollController 通过 animateTo 方法滚动到某个具体高度
          // duration 表示动画的时长，curve 表示动画的运行方式，flutter 在 Curves 提供了许多方式
          state.scrollController.animateTo(0.0,
              duration: Duration(milliseconds: 500),
              curve: Curves.decelerate);
        },
        child: Icon(Icons.arrow_upward_sharp,color: Colors.grey,size: 40,),
      )
  );
}
